# -*- coding: utf-8 -*-

from flask import Flask,render_template,views

app = Flask(__name__)

class Ads(views.View):

    def __init__(self):
        super(Ads, self).__init__()
        self.context = {
            'Ads': u'这是对联广告',
        }

class Index(Ads):
    def dispatch_request(self):
        return render_template('index.html', **self.context)


class login(Ads):
    def dispatch_request(self):
        return render_template('login.html', **self.context)

class Register(Ads):
    def dispatch_request(self):
        return render_template('register.html', **self.context)

app.add_url_rule(rule='/', endpoint='index', view_func=Index.as_view('Index'))
app.add_url_rule(rule='/login/', endpoint='login', view_func=login.as_view('login'))
app.add_url_rule(rule='/register/', endpoint='register', view_func=login.as_view('register'))

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=5555)